package com.lt.lumentracks.controller.common;

import com.lt.lumentracks.entity.vo.common.Result;
import com.lt.lumentracks.utils.jwtUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/common/jwt")
public class JwtController {


    /**
     * 解析Jwt令牌
     * @param Jwt 传入的jwt令牌
     * @return 解析结果
     */
    @GetMapping("/Parse/{Jwt}")
    public Result<Object> Parse(@PathVariable String Jwt) {
        Object obj;
        try {
            obj = jwtUtils.ParseJwt(Jwt); //调用工具类的方法，解析令牌
        } catch (Exception e) {
            return Result.error("NOT_LOGIN");
        }
        return Result.success(obj);
    }

}
